Feature: Global Header - Get Login User API

  # Author: Maria Chen
  # Execution&Update History
  # |Date          |Owner        |Update/Execution Remark        |Comments                          |
  # |3/21/2016    |Maria Chen   |First Draft                    |
  Background: 
    Given these Users:
      | userId   | firstname     | lastname    | email                                   |
      | 10000001 | CliffAssurant | ZhuAssurant | 782@11.29.16.28.16.7732018.com551       |
      | 10000002 | null          | null        | mb@ifp.qa.0.2007.11.29.17.28.15.992.com |
      | 10000003 |               |             |                                         |

  @happy
  Scenario: Get login user with vaild cookie info
    Given user 10000001 has logged in
    When I send a GET request to "user/login-user"
    Then the response status should be 200
    And the JSON response should be
      """
      {
        "firstName":"CliffAssurant",
        "lastName":"ZhuAssurant",
        "email":"782@11.29.16.28.16.7732018.com551"
      }
      """

  @happy
  Scenario: Get Login user with valid cookie info - User name is null
    Given user 10000002 has logged in
    When I send a GET request to "user/login-user"
    Then the response status should be 200
    And the JSON response should be
      """
      {
      "firstName": null,
      "lastName": null,
      "email": "mb@ifp.qa.0.2007.11.29.17.28.15.992.com"
      }
      """

  @sad
  Scenario: Not user login - System return empty info
    Given user has not logged in
    When I send a GET request to "user/login-user"
    Then the response status should be 200
    And the JSON response should be
      """
      {}
      """

  @sad
  Scenario: Token is expired or invalid - System return empty info
    Given user 10000003 has logged in
    And user 10000003 has logged out
    When I send a GET request to "user/login-user"
    Then the response status should be 200
    And the JSON response should be
      """
      {}
      """

  @sad
  Scenario: URL invalid - System return resource not exist
    Given user 10000003 has logged in
    When I send a GET request to "user/login-user/test"
    Then the response status should be 404
    And the error type should be "RESOURCE_NOT_FOUND"
    And the error message should be "Resource doesn't exist"
